package com.hk.app.utils;

import java.math.BigDecimal;

/**
 * @author Antinomy
 * @date 18/1/28
 */
public class SellRule {
    public static Boolean allowToBuy(BigDecimal buyAmount, BigDecimal minBuyAmount, BigDecimal minAppendAmount) {
        BigDecimal appendPart = buyAmount.subtract(minBuyAmount);
        BigDecimal dividePart = appendPart.divide(minAppendAmount, 2, BigDecimal.ROUND_DOWN);

        return dividePart.scale() <= 0 || dividePart.stripTrailingZeros().scale() <= 0;
    }
}
